<%@ page contentType="text/html;charset=UTF-8" pageEncoding="utf8" language="java" %>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf8">
    <title><spring:message code="label.title"/></title>
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/bootstrap/css/bootstrap.min.css"/>"/>
    <script src="<c:url value='/resources/bootstrap/js/bootstrap.min.js'/>"></script>
    <script src="<c:url value='/resources/scripts/jquery.min.js'/>"></script>
</head>
<body>
<%@include file="/WEB-INF/views/header.jsp" %>

<div class="panel panel-default">
    <div class="panel-heading">
        <h1><spring:message code="label.login"/></h1>
    </div>

    <div class="panel-body">
        <c:if test="${not empty error}">
            <div id='myAlert' class="alert alert-danger text-center">
                <a href="#" class="close" data-dismiss="alert">&times;</a>
                    ${error}
            </div>
        </c:if>
        <c:if test="${not empty message}">
            <div id='myAlert' class="alert alert-info text-center">
                <a href="#" class="close" data-dismiss="alert">&times;</a>
                    ${message}
            </div>
        </c:if>

        <script type="text/javascript">
            $(function(){
                $(".close").click(function(){
                    $("#myAlert").hide();
                });
            });

        </script>

        <form action="<c:url value="/j_spring_security_check" />" method="POST" class="form-horizontal" role="form">
            <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>

            <div class="form-group">
                <label for="user-email" class="col-sm-2 control-label"><spring:message code="label.user.email"/></label>

                <div class="col-sm-10">
                    <input id="user-email" name="j_username" type="email" class="form-control" placeholder="Email">
                </div>
            </div>

            <div class="form-group">
                <label for="user-password" class="col-sm-2 control-label"><spring:message
                        code="label.user.password"/></label>

                <div class="col-sm-10">
                    <input id="user-password" name="j_password" type="password" class="form-control"
                           placeholder="Password">
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <div class="checkbox">
                        <label>
                            <input id="remember-me" name="_spring_security_remember_me" type="checkbox"><spring:message
                                code="label.remember"/>
                        </label>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-default"><spring:message code="label.login.submit"/></button>
                </div>
            </div>
            <%--<div class="row">--%>
            <%--<div id="form-group-email" class="form-group col-lg-4">--%>
            <%--<label class="control-label" for="user-email"><spring:message code="label.user.email"/>:</label>--%>
            <%--<input id="user-email" name="j_username" type="text" class="form-control"/>--%>
            <%--</div>--%>
            <%--</div>--%>

            <%--<div class="row">--%>
            <%--<div id="form-group-password" class="form-group col-lg-4">--%>
            <%--<label class="control-label" for="user-password"><spring:message--%>
            <%--code="label.user.password"/>:</label>--%>
            <%--<input id="user-password" name="j_password" type="password" class="form-control"/>--%>
            <%--</div>--%>
            <%--</div>--%>

            <%--<div class="row">--%>
            <%--<div id="form-group-remember" class="form-group col-lg-4">--%>
            <%--<spring:message code="label.remember"/>:--%>
            <%--<input id="remember-me" name="_spring_security_remember_me" type="checkbox" class="checkbox"/>--%>
            <%--</div>--%>
            <%--</div>--%>

            <%--<div class="row">--%>
            <%--<div class="form-group col-lg-4">--%>
            <%--<button type="submit" class="btn btn-default"><spring:message code="label.login.submit"/></button>--%>
            <%--</div>--%>
            <%--</div>--%>
        </form>
    </div>
</div>

</body>
</html>
